# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-googletransx
pkgname=('python2-googletransx' 'python-googletransx')
_pkgname=googletransx
pkgver=2.4.2
pkgrel=8
pkgdesc='Free Google Translate API for Python. Translates totally free of charge.'
arch=('any')
url='https://pypi.org/project/googletransx/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('d68d3ae0bf250464438831e97c5ab87484100302ccb92da929218fe42d00c572770c4083919916b537f40b2ea5b33197fb2c69197cc541da28977027be86ceb5')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-googletransx() {
  depends=('python2' 'python2-requests')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build

  mv "$pkgdir/usr/bin/translate" "$pkgdir/usr/bin/${_pkgname}2"
}

package_python-googletransx() {
  depends=('python' 'python-requests')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build

  mv "$pkgdir/usr/bin/translate" "$pkgdir/usr/bin/$_pkgname"
}

